#!/bin/sh

set -x

# default return code is 0
rc=0

hab pkg exec core/curl curl --head --fail --max-time 1 http://localhost

case $? in
  # Zero exit status means curl got back a 200 end everything is ok.
  0)
    rc=0 ;;
  # Anything else is critical
  *)
    rc=2 ;;
esac

exit $rc
